package com.tsunami.adapter;

import java.text.SimpleDateFormat;
import java.util.Date;

import android.content.Context;
import android.database.Cursor;
import android.view.View;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;

import com.tsunami.R;
import com.tsunami.provider.TodoList;

public class TaskAdapter extends SimpleCursorAdapter {

	
    
	
	public TaskAdapter(Context _context, int _layout, Cursor _c, String[] _from,
			int[] _to) {
		super(_context, _layout, _c, _from, _to);		
	}


	
	@Override
	public void bindView(View view, Context _context, Cursor _cursor) {

		long milliseconds = _cursor.getLong(_cursor
				.getColumnIndex(TodoList.Task.COLUMN_NAME_CREATED_DATE));
		Date dateCreated = new Date(milliseconds);
		SimpleDateFormat formater = new SimpleDateFormat("MM/dd/yyyy");
		((TextView) view.findViewById(R.id.dateCreated)).setText(formater.format(dateCreated));

		super.bindView(view, _context, _cursor);
	}
	
	

}
